# frozen_string_literal: true

require "bundler/gem_tasks"

$LOAD_PATH.unshift File.expand_path("lib", __dir__)
$LOAD_PATH.unshift File.expand_path("../bridgetown-foundation/lib", __dir__)
require "bridgetown/version"

task spec: :test
require "rake/testtask"
Rake::TestTask.new(:test) do |test|
  test.libs << "lib" << "test"
  test.pattern = "test/**/test_*.rb"
  test.verbose = true
end

require "yard"
YARD::Rake::YardocTask.new(:yard) do |t|
  t.files = ["lib/**/*.rb"]
  t.options = ["--no-output"]
  t.stats_options = ["--list-undoc"]
end

namespace :yard do
  task :serve do
    port = ENV["YARD_PORT"] || "8808"
    sh("yard server --reload -p #{port}")
  end
end
